home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 2000 October: Mac OS SDK / Dev.CD Oct 00 SDK1.toast / Development Kits / Mac OS / Display Manager SDK / Sample Code / DMFkey Source / DMFkey.c < prev    next >
Encoding:
C/C++ Source or Header  |  1999-01-20  |  2.9 KB  |  94 lines  |  [TEXT/CWIE]

  1. /*—————————————————————————————————————————————————————————————————————————————————————
  2. #
  3. #    Display Flip FKey 1.0.
  4. #    
  5. #    Written by: Eric Anderson
  6. #     email: eric3@apple.com
  7. #
  8. #    Display Manager sample code using FKey
  9. #
  10. #    • Display Flip FKEY=0
  11. #
  12. #    DMFkey.c    -    C Code
  13. #
  14. #    Copyright © 1996 Eric3 Anderson
  15. #    Free to distribute, modify, fold, spindle, and mutilate. Whatever.
  16. #
  17. #    1/17/99        ewa        Update comments
  18. #    2/10/96        ewa        New today.
  19. #
  20. #
  21. #
  22. #    Components:    DMFkey.c            
  23. #                RequestVideo.c        
  24. #                RequestVideo.h        
  25. #
  26. #    Uses Display Manager 2.0 (found in System 7.5.2 and later, or in
  27. #    the version 2.0 Display Enabler system extension which ships with AppleVision
  28. #    display software) to change the monitor screen resolution
  29. #    the specified HxV resolutions.
  30. #
  31. #    This FKey will flip between 640x480 and BIG.
  32. #    BIG is set to 2000x2000, you will get the largest size up to this setting.
  33. #
  34. #    For information on the use of the RequestVideo sample code, please refer to the
  35. #    documentation found in the Display Manager Development Kit, or just look at the 
  36. #    code and comments to figure it out.
  37. —————————————————————————————————————————————————————————————————————————————————————*/
  38.  
  39. #define minHorizontalRequest        640
  40. #define minVerticalRequest            480
  41.  
  42. #define maxHorizontalRequest        2000
  43. #define maxVerticalRequest            2000
  44.  
  45. #define bitDepthRequest                32
  46.  
  47. #include <Types.h>
  48. #include <Quickdraw.h>
  49.  
  50. #include "RequestVideo.h"                    // The code that does the real work
  51.  
  52. struct INITGlobals {
  53.     QDGlobals        initQDGlobals;            // FKEY's own private QDGlobals
  54.     unsigned long    initQDBase;                // FKEY's global base
  55. };
  56. typedef struct INITGlobals INITGlobals;
  57.  
  58. main()
  59. {
  60.     VideoRequestRec    requestRec;
  61.     INITGlobals        qdGlobs;
  62.     long            oldA5;
  63.     unsigned long    theHorizontalRequest;
  64.     unsigned long    theVerticalRequest;        
  65.     
  66.     oldA5 = SetA5((long) &qdGlobs.initQDBase);
  67.     InitGraf((Ptr) &qdGlobs.initQDGlobals.thePort);
  68.     
  69.     theHorizontalRequest = minHorizontalRequest;
  70.     theVerticalRequest = minVerticalRequest;
  71.  
  72.     requestRec.screenDevice = GetMainDevice ();
  73.     requestRec.reqHorizontal = (*(*(requestRec.screenDevice))->gdPMap)->bounds.right;    // main screen is always zero offset (bounds.left == 0)
  74.     requestRec.reqVertical = (*(*(requestRec.screenDevice))->gdPMap)->bounds.bottom;    // main screen is always zero offset (bounds.top == 0)
  75.      if (requestRec.reqHorizontal == minHorizontalRequest || requestRec.reqVertical == minVerticalRequest)    // on a small screen now?
  76.      {
  77.          theHorizontalRequest    =    maxHorizontalRequest;
  78.          theVerticalRequest        =    maxVerticalRequest;
  79.      }
  80.  
  81.     requestRec.reqBitDepth        =    bitDepthRequest;        // bit depth request
  82.     requestRec.reqHorizontal    =    theHorizontalRequest;    // H request
  83.     requestRec.reqVertical        =    theVerticalRequest;        // V request
  84.     requestRec.displayMode        =    nil;                    // must init to nil
  85.     requestRec.depthMode        =    nil;                    // must init to nil
  86.     requestRec.requestFlags        =    0;                        
  87.     if (noErr == RVRequestVideoSetting(&requestRec))
  88.     {
  89.         RVSetVideoRequest (&requestRec);
  90.     }
  91.     SetA5(oldA5);
  92.     return (noErr);
  93. }
  94.